<div id="maincontent">
    <div class="heading">
        <div class="buttons"><a onclick="location='<?= base_url() . 'admin/managegallery/add' ?>'" class="button"><span class="button_left button_insert"></span><span class="button_middle">Thêm</span><span class="button_right"></span></a><a onclick="$('form').submit();" class="button"><span class="button_left button_delete"></span><span class="button_middle">Xoá</span><span class="button_right"></span></a></div>
    </div>
    <form action="<?= base_url() . 'admin/managegallery/delete' ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
            <thead style="height: 34px;font-weight: bold;">
                <tr>
                    <td width="1" align="center"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                    
                    <td class="left">Name</td>
                    <td class="left">Num of Photo(s)</td>
                    <td class="left">Description</td>
                    <td class="left">Show in top/bigslide</td>
                    <td class="right">Action</td>
                </tr>
            </thead>
            <tbody>
                <?php if ($galleries) { ?>
                    <?php $class = 'odd'; ?>
                    <?php foreach ($galleries as $gallery) { ?>
                        <?php $class = ($class == 'even' ? 'odd' : 'even'); ?>
                        <tr class="<?php echo $class; ?>">
                            <td align="center">
                                <input type="checkbox" name="selected[]" value="<?php echo $gallery->id; ?>" />
                            </td>
                            
                            <td class="left"><?= $gallery->name ?></td>
                            <td class="left"><?= $gallery->photo ?></td>
                            <td class="left"><?= $gallery->description ?></td>
                            <td class="left"><?php if ($gallery->show_top)
                    echo 'Yes'; else
                    echo 'No';
		    if ($gallery->show_slide)
                    echo '/Yes'; else
                    echo '/No';
		    
		    ?></td>
                            <td class="right">
                                [ <a href="<?= base_url() . 'admin/managegallery/update/' . $gallery->id ?>">Edit</a> ]
                            </td>
                        </tr>
    <?php } ?>
<?php } ?>
            </tbody>
        </table>
    </form>
</div>